home *** CD-ROM | disk | FTP | other *** search
/ Pascal Super Library / Pascal Super Library (CW International)(1997).bin / LIBRARY / CMPLTPAS / DISPDIR.PAS < prev    next >
Pascal/Delphi Source File  |  1988-07-14  |  1KB  |  26 lines

  1. {->>>>DisposeOfDirectory<<<<-----------------------------------}
  2. {                                                              }
  3. { Filename : DISPDIR.SRC -- Last Modified 7/11/88              }
  4. {                                                              }
  5. { This routine disposes of lists of DIRRec records as built by }
  6. { GetDirectory.  Type DIRRec and DIRPtr must be defined prior  }
  7. { to its inclusion.                                            }
  8. {                                                              }
  9. {     From: COMPLETE TURBO PASCAL 5.0  by Jeff Duntemann       }
  10. {    Scott, Foresman & Co., Inc. 1988   ISBN 0-673-38355-5     }
  11. {--------------------------------------------------------------}
  12.  
  13. PROCEDURE DisposeOfDirectory(RootPointer : DIRPtr);
  14.  
  15. VAR
  16.   Holder : DIRPtr;
  17.  
  18. BEGIN
  19.   IF RootPointer <> NIL THEN       { Can't dispose if no list! }
  20.   REPEAT
  21.     Holder := RootPointer^.Next;   { Grab the next record. }
  22.     Dispose(RootPointer);          { Dispose of the first... }
  23.     RootPointer := Holder          { ...and make the next the first... }
  24.   UNTIL RootPointer = NIL          { ...until the list is all gone. }
  25. END;
  26.